<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
  <title>Promise</title>
  <style type="text/css">
  * {
        padding: 0;
        margin: 0;
    }
    </style>
</head>
<body>
   <div class="box">
     <h2>Promise</h2>
   </div>
  <script src="index.js"></script>
  <script src="php/ajax.js"></script>
  <script type="text/javascript">
async function p1() {
  return new Promise(resolve => {
    setTimeout(() => {
      console.log("houdunren");
      resolve('p1 hello');
    }, 2000);
  });
}
async function p2() {
  return new Promise(resolve => {
    setTimeout(() => {
      console.log("hdcms");
      resolve('p2 world');
    }, 2000);
  });
}


(async function hd() {
  console.time('并行')
  let ret = await Promise.all([p1(), p2()]);
  console.log(`ret = ${ret}, 类型:${typeof ret}`)
  console.timeEnd('并行')
})()




  </script>
</body>
</html>